package com.framwork.core.api.addressbook;

import com.framwork.core.api.addressbook.dept.input.*;
import com.framwork.core.api.addressbook.dept.result.*;
import com.framwork.core.api.addressbook.user.input.OpenApisContactV3UsersFindByDepartmentInput;
import com.framwork.core.api.addressbook.user.result.OpenApisContactV3UsersFindByDepartmentResult;
import com.framwork.core.base.DefaultAPIActionProxy;
import com.framwork.core.config.APIClientConfiguration;

/**
 * @author ：james.liu
 * @date ：Created in 2022/3/4 14:47
 * @description：
 * @version: 1.0
 */
public class AddressBookClient {

    private final APIClientConfiguration configuration;

    public AddressBookClient(final APIClientConfiguration configuration) {
        this.configuration = configuration;
    }

    /**
     * 获取部门直属用户列表
     *
     * @param input
     * @return
     * @throws Exception
     */
    public OpenApisContactV3UsersFindByDepartmentResult openApisContactV3UsersFindByDepartment(
            final OpenApisContactV3UsersFindByDepartmentInput input) throws Exception {
        input.eventCmd();
        return DefaultAPIActionProxy.getInstance().doGetAction(
                input, configuration,
                OpenApisContactV3UsersFindByDepartmentResult.class,
                input.toBody(input)
        );
    }


    ///// 部门

    /**
     * 部门列表
     *
     * @param input
     * @return
     * @throws Exception
     */
    public OpenApisContactV3DepartmentsDepartmentIdChildrenResult openApisContactV3DepartmentsDepartmentIdChildren(
            final OpenApisContactV3DepartmentsDepartmentIdChildrenInput input) throws Exception {
        input.eventCmd();
        return DefaultAPIActionProxy.getInstance().doGetAction(
                input, configuration,
                OpenApisContactV3DepartmentsDepartmentIdChildrenResult.class,
                input.toBody(input));
    }

    /**
     * 获取父部门信息
     *
     * @param input
     * @return
     * @throws Exception
     */
    public OpenApisContactV3DepartmentsParentResult openApisContactV3DepartmentsParent(
            final OpenApisContactV3DepartmentsParentInput input
    ) throws Exception {
        input.eventCmd();
        return DefaultAPIActionProxy.getInstance().doGetAction(
                input, configuration,
                OpenApisContactV3DepartmentsParentResult.class,
                input.toBody(input));
    }

    /**
     * 获取单个部门信息
     *
     * @param input
     * @return
     * @throws Exception
     */
    public OpenApisContactV3DepartmentsDepartmentIdResult openApisContactV3DepartmentsDepartmentId(
            final OpenApisContactV3DepartmentsDepartmentIdInput input) throws Exception {
        input.eventCmd();
        return DefaultAPIActionProxy.getInstance().doGetAction(
                input, configuration,
                OpenApisContactV3DepartmentsDepartmentIdResult.class,
                input.toBody(input));
    }

    /**
     * 搜索部门
     *
     * @param input
     * @return
     * @throws Exception
     */
    public OpenApisContactV3DepartmentsSearchResult openApisContactV3DepartmentsSearch(
            final OpenApisContactV3DepartmentsSearchInput input) throws Exception {
        input.eventCmd();
        return DefaultAPIActionProxy.getInstance().doGetAction(
                input, configuration,
                OpenApisContactV3DepartmentsSearchResult.class,
                input.toBody(input));
    }

    /**
     * 添加部门
     *
     * @param input
     * @return
     */
    public OpenApisContactV3DepartmentsResult openApisContactV3Departments(
            final OpenApisContactV3DepartmentsInput input
    ) {
//        input.eventCmd();
//        return DefaultAPIActionProxy.getInstance().doGetAction(
//                input, configuration,
//                OpenApisContactV3DepartmentsResult.class,
//                input.toBody(input));
        return null;
    }


}
